﻿<UserControl x:Class="CustomerEdit"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:Metro="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
             xmlns:Fluent="clr-namespace:Fluent;assembly=Fluent"
             xmlns:local="clr-namespace:Biller"
             mc:Ignorable="d" 
             d:DesignHeight="1000" d:DesignWidth="1000" DataContextChanged="UserControl_DataContextChanged_1">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="./de.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colours.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.AnimatedSingleRowTabControl.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Blue.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
            </ResourceDictionary.MergedDictionaries>
            <Style TargetType="TextBlock" x:Key="HeaderStyle">
                <Setter Property="FontSize" Value="{StaticResource HeaderFontSize}"/>
                <Setter Property="FontFamily" Value="{StaticResource HeaderFontFamily}"/>
            </Style>
            <Style TargetType="TextBlock" x:Key="SubHeaderStyle">
                <Setter Property="FontSize" Value="{StaticResource SubHeaderFontSize}"/>
                <Setter Property="FontFamily" Value="{StaticResource HeaderFontFamily}"/>
                <Setter Property="Margin" Value="0,5"/>
            </Style>
            <Style TargetType="TextBlock" x:Key="ContentStyle">
                <Setter Property="FontSize" Value="{StaticResource NormalFontSize}"/>
                <Setter Property="FontFamily" Value="{StaticResource ContentFontFamily}"/>
            </Style>
            <local:EmptyStringConverter x:Key="EmptyStringConverter"/>
            <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
            <local:ValueConverterGroup x:Key="EmptyStringVisibility">
                <local:EmptyStringConverter/>
                <local:InverseBooleanConverter/>
                <BooleanToVisibilityConverter/>
            </local:ValueConverterGroup>
            <local:ValueConverterGroup x:Key="InvertAndVisibilitate">
                <local:InverseBooleanConverter/>
                <BooleanToVisibilityConverter/>
            </local:ValueConverterGroup>
            <local:InverseBooleanConverter x:Key="InverseBooleanConverter"/>
            <ControlTemplate x:Key="ButtonBackstageControlTemplate" TargetType="{x:Type Fluent:Button}">
                <Grid>
                    <Border x:Name="border" BorderThickness="1" Margin="0" Background="White" BorderBrush="LightGray">
                        <StackPanel Margin="2" x:Name="stackPanel">
                            <ContentPresenter x:Name="iconImage" HorizontalAlignment="Center" Height="32" Width="32" VerticalAlignment="Center" Content="{Binding LargeIcon, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource StringToImageConvert}}" Margin="9,9,9,0" SnapsToDevicePixels="True"/>
                            <Fluent:TwoLineLabel x:Name="twoLineLabel" Margin="7,7,7,5" VerticalAlignment="Center" Text="{TemplateBinding Header}"/>
                        </StackPanel>
                    </Border>
                </Grid>
                <ControlTemplate.Triggers>
                    <Trigger Property="IsEnabled" Value="False">
                        <Setter Property="Opacity" TargetName="iconImage" Value="0.5"/>
                        <Setter Property="Opacity" TargetName="twoLineLabel" Value="0.5"/>
                        <Setter Property="BorderBrush" TargetName="border" Value="#FFC8C8C9"/>
                        <Setter Property="Effect" TargetName="iconImage">
                            <Setter.Value>
                                <Fluent:GrayscaleEffect/>
                            </Setter.Value>
                        </Setter>
                    </Trigger>
                    <Trigger Property="IsMouseOver" Value="True">
                        <Setter Property="Background" TargetName="border">
                            <Setter.Value>
                                <SolidColorBrush Color="#FF5195B7" Opacity="0.1"/>
                            </Setter.Value>
                        </Setter>
                        <Setter Property="BorderBrush" TargetName="border">
                            <Setter.Value>
                                <SolidColorBrush Color="#FF5195B7" Opacity="0.6"/>
                            </Setter.Value>
                        </Setter>
                    </Trigger>
                    <Trigger Property="IsFocused" Value="True">
                        <Setter Property="Background" TargetName="border">
                            <Setter.Value>
                                <SolidColorBrush Color="#FF5195B7" Opacity="0.1"/>
                            </Setter.Value>
                        </Setter>
                        <Setter Property="BorderBrush" TargetName="border">
                            <Setter.Value>
                                <SolidColorBrush Color="#FF5195B7" Opacity="0.6"/>
                            </Setter.Value>
                        </Setter>
                    </Trigger>
                    <Trigger Property="IsPressed" Value="True">
                        <Setter Property="BorderBrush" TargetName="border">
                            <Setter.Value>
                                <SolidColorBrush Color="#FF5195B7" Opacity="1"/>
                            </Setter.Value>
                        </Setter>
                        <Setter Property="Background" TargetName="border" >
                            <Setter.Value>
                                <SolidColorBrush Color="#FF5195B7" Opacity="0.5"/>
                            </Setter.Value>
                        </Setter>
                    </Trigger>
                </ControlTemplate.Triggers>
            </ControlTemplate>
            <Style TargetType="{x:Type Fluent:Button}" x:Key="MetroButtonBackstageStyle">
                <Setter Property="Template" Value="{StaticResource ButtonBackstageControlTemplate}"/>
                <Setter Property="Height" Value="81"/>
                <Setter Property="Width" Value="85"/>
            </Style>
        </ResourceDictionary>
    </UserControl.Resources>
    <StackPanel>
        <TextBlock Style="{StaticResource HeaderStyle}" Text="Kunde erstellen"/>
        <TextBlock Style="{StaticResource SubHeaderStyle}" Text="Identifikation"/>
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="150"/>
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <Grid>
                <Image Height="64" Source="../../Images/fingerprint.png"/>
            </Grid>
            <StackPanel Grid.Column="1">
                <TextBox Width="{Binding ElementName=helperwidth1,Path=ActualWidth}" Text="{Binding CustomerID}" Metro:TextboxHelper.Watermark="Kundennummer" HorizontalAlignment="Left" Margin="0,5,0,0" Name="textbox"/>
            </StackPanel>
        </Grid>

        <TextBlock Style="{StaticResource SubHeaderStyle}" Text="Rechnungsanschrift" Margin="0,10,0,5"/>
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="150"/>
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <Grid>
                <Image Height="64" Source="../../Images/home.png"/>
            </Grid>
            <StackPanel Grid.Column="1">
                <StackPanel Orientation="Horizontal" Margin="0,5,0,0">
                    <RadioButton Content="Privatperson" GroupName="IsCompany" IsChecked="{Binding IsCompany, Converter={StaticResource InverseBooleanConverter}}"/>
                    <RadioButton Content="Firma" Margin="15,0,0,0" GroupName="IsCompany" IsChecked="{Binding IsCompany}"/>
                </StackPanel>
                <TextBox Width="{Binding ElementName=helperwidth1,Path=ActualWidth}" Text="{Binding Address.CompanyName}" Metro:TextboxHelper.Watermark="Firmenname" HorizontalAlignment="Left" Margin="0,5,0,0" Visibility="{Binding IsCompany, Converter={StaticResource BooleanToVisibilityConverter}}"/>
                <StackPanel Orientation="Horizontal">
                    <TextBox Width="{Binding ElementName=helperwidth1,Path=ActualWidth}" Text="{Binding Address.Salutation}" Metro:TextboxHelper.Watermark="Anrede" HorizontalAlignment="Left" Margin="0,5,0,0" Visibility="{Binding IsCompany, Converter={StaticResource InvertAndVisibilitate}}"/>
                    <TextBox Width="{Binding ElementName=helperwidth1,Path=ActualWidth}" Text="{Binding Address.Title}" Metro:TextboxHelper.Watermark="Titel" HorizontalAlignment="Left" Margin="5,5,0,0" Visibility="{Binding IsCompany, Converter={StaticResource InvertAndVisibilitate}}"/>
                </StackPanel>
                <StackPanel Orientation="Horizontal">
                    <TextBox Width="{Binding ElementName=helperwidth1,Path=ActualWidth}" Text="{Binding Address.Forname}" Metro:TextboxHelper.Watermark="Vorname" HorizontalAlignment="Left" Margin="0,5,0,0"/>
                    <TextBox Width="{Binding ElementName=helperwidth1,Path=ActualWidth}" Text="{Binding Address.Surname}" Metro:TextboxHelper.Watermark="Nachname" HorizontalAlignment="Left" Margin="5,5,0,0"/>
                </StackPanel>
                <TextBox Width="{Binding ElementName=helperwidth1,Path=ActualWidth}" Text="{Binding Address.Addition}" Metro:TextboxHelper.Watermark="Zusatz" HorizontalAlignment="Left" Margin="0,5,0,0"/>
                <StackPanel Orientation="Horizontal">
                    <TextBox Width="{Binding ElementName=helperwidth1,Path=ActualWidth}" Text="{Binding Address.Street}" Metro:TextboxHelper.Watermark="Straße" HorizontalAlignment="Left" Margin="0,5,0,0"/>
                    <TextBox Width="{Binding ElementName=helperwidth1,Path=ActualWidth}" Text="{Binding Address.No}" Metro:TextboxHelper.Watermark="Hausnummer" HorizontalAlignment="Left" Margin="5,5,0,0"/>
                </StackPanel>
                <StackPanel Orientation="Horizontal">
                    <TextBox Width="{Binding ElementName=helperwidth1,Path=ActualWidth}" Text="{Binding Address.ZipCode}" Metro:TextboxHelper.Watermark="Postleitzahl" HorizontalAlignment="Left" Margin="0,5,0,0"/>
                    <TextBox Width="{Binding ElementName=helperwidth1,Path=ActualWidth}" Text="{Binding Address.City}" Metro:TextboxHelper.Watermark="Stadt" HorizontalAlignment="Left" Margin="5,5,0,0"/>
                </StackPanel>

                <TextBox Width="{Binding ElementName=helperwidth1,Path=ActualWidth}" Text="{Binding Address.Country}" Metro:TextboxHelper.Watermark="Land" HorizontalAlignment="Left" Margin="0,5,0,0"/>
            </StackPanel>
            <Grid Grid.Column="1">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" MaxWidth="250" MinWidth="100"/>
                    <ColumnDefinition Width="*" MaxWidth="250" MinWidth="100"/>
                    <ColumnDefinition Width="*" MaxWidth="250" MinWidth="100"/>
                    <ColumnDefinition Width="*" MaxWidth="250" MinWidth="100"/>
                </Grid.ColumnDefinitions>
                <Grid Name="helperwidth1"/>
            </Grid>
        </Grid>
        
        <TextBlock Style="{StaticResource SubHeaderStyle}" Text="Weitere Adressen" Margin="0,10,0,0"/>
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="150"/>
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <Grid>
                <Fluent:Button Style="{StaticResource MetroButtonBackstageStyle}" Icon="../../Images/home.png" LargeIcon="../../Images/home.png" Name="CustomerAddAddress" Width="100" Height="85" Margin="0,7,0,0" VerticalAlignment="Top" Header="Adresse hinzufügen"/>
            </Grid>
            <StackPanel Grid.Column="1"  Name="StackPanelEAddresses">
                <TextBlock Style="{StaticResource ContentStyle}" Text="Keine weiteren Adressen" Margin="0,5,0,0" Name="lbl_noeadresses"/>
            </StackPanel>
        </Grid>

        <TextBlock Style="{StaticResource SubHeaderStyle}" Text="Kontakt" Margin="0,10,0,0"/>
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="150"/>
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <Grid>
                <Image Height="64" Source="../../Images/contact.png"/>
            </Grid>
            <StackPanel Grid.Column="1">
                <TextBox Width="{Binding ElementName=helperwidth1,Path=ActualWidth}" Text="{Binding Contact.Telefon1}" Metro:TextboxHelper.Watermark="Telefon Privat" HorizontalAlignment="Left" Margin="0,5,0,0"/>
                <TextBox Width="{Binding ElementName=helperwidth1,Path=ActualWidth}" Text="{Binding Contact.Telefon2}" Metro:TextboxHelper.Watermark="Telefon Arbeit" HorizontalAlignment="Left" Margin="0,5,0,0"/>
                <TextBox Width="{Binding ElementName=helperwidth1,Path=ActualWidth}" Text="{Binding Contact.Telefax1}" Metro:TextboxHelper.Watermark="Fax" HorizontalAlignment="Left" Margin="0,5,0,0"/>
                <TextBox Width="{Binding ElementName=helperwidth1,Path=ActualWidth}" Text="{Binding Contact.Mobil1}" Metro:TextboxHelper.Watermark="Mobil" HorizontalAlignment="Left" Margin="0,5,0,0"/>
                <TextBox Width="{Binding ElementName=helperwidth1,Path=ActualWidth}" Text="{Binding Contact.Mail1}" Metro:TextboxHelper.Watermark="E-Mail" HorizontalAlignment="Left" Margin="0,5,0,0"/>
                <TextBox Width="{Binding ElementName=helperwidth1,Path=ActualWidth}" Text="{Binding Contact.Facebook}" Metro:TextboxHelper.Watermark="Facebook" HorizontalAlignment="Left" Margin="0,5,0,0"/>
                <TextBox Width="{Binding ElementName=helperwidth1,Path=ActualWidth}" Text="{Binding Contact.Twitter}" Metro:TextboxHelper.Watermark="Twitter" HorizontalAlignment="Left" Margin="0,5,0,0"/>
            </StackPanel>
        </Grid>

        <TextBlock Style="{StaticResource SubHeaderStyle}" Text="Voreinstellungen" Margin="0,10,0,0"/>
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="150"/>
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <Grid>
                <Image Height="64" Source="../../Images/settings.png"/>
            </Grid>
            <StackPanel Grid.Column="1">
                <StackPanel Orientation="Horizontal" Margin="0,5,0,0">
                    <TextBlock Style="{StaticResource ContentStyle}" Text="Standard Preisgruppe" VerticalAlignment="Center" Width="{Binding ElementName=helperwidth1,Path=ActualWidth}"/>
                    <ComboBox Margin="5,0,0,0" VerticalAlignment="Center" Width="{Binding ElementName=helperwidth1, Path=ActualWidth}" Name="PriceGroupComboBox" SelectedIndex="0">
                        <ComboBoxItem Content="Preisgruppe 1"/>
                        <ComboBoxItem Content="Preisgruppe 2"/>
                        <ComboBoxItem Content="Preisgruppe 3"/>
                    </ComboBox>
                </StackPanel>
                <StackPanel Orientation="Horizontal" Margin="0,5,0,0">
                    <TextBlock Style="{StaticResource ContentStyle}" Text="Standard Bezahlmethode" VerticalAlignment="Center" Width="{Binding ElementName=helperwidth1,Path=ActualWidth}"/>
                    <ComboBox Margin="5,0,0,0" VerticalAlignment="Center" Width="{Binding ElementName=helperwidth1,Path=ActualWidth}" SelectedItem="{Binding PaymentMethode}" Name="cb_payment" DisplayMemberPath="Name"/>
                </StackPanel>
            </StackPanel>
        </Grid>
    </StackPanel>
</UserControl>
